#ifndef __RS485_H
#define __RS485_H			 
#include "sys.h"

#define RS485_BUFF_LEN		(400)

typedef struct
{
	u8* rs485buf;
	u16 rs485RxCnt;
} RS485_POOL_EX_T;

typedef struct
{
	RS485_POOL_EX_T rs485PoolSub[5];
} RS485_POOL_T;

typedef struct
{
	u8* rs485dmabuf1;
	u8* rs485dmabuf3;
	u8* rs485dmabuf4;
	u8* rs485dmabuf5;
	u8* rs485dmabuf6;
}RS485_DMA_POOL_T;

#define RS485_1_TX_EN	PBout(12)

#define RS485_3_TX_EN	PAout(8)

#define RS485_4_TX_EN	PAout(15)

#define RS485_5_TX_EN	PDout(6)

#define RS485_6_TX_EN	PCout(8)
														 
void RS485_Init(u32 bound);

void RS485_Res_init(void);

void RS485_1_Send_Data(u8 *buf, u16 len);
void RS485_1_Receive_Data(u8 *buf, u16 *len);	

void RS485_3_Send_Data(u8 *buf, u16 len);
void RS485_3_Receive_Data(u8 *buf, u16 *len);	

void RS485_4_Send_Data(u8 *buf, u16 len);
void RS485_4_Receive_Data(u8 *buf, u16 *len);	

void RS485_5_Send_Data(u8 *buf, u16 len);
void RS485_5_Receive_Data(u8 *buf, u16 *len);	

void RS485_6_Send_Data(u8 *buf, u16 len);
void RS485_6_Receive_Data(u8 *buf, u16 *len);

void Uart_DMA_Init(void);

extern RS485_POOL_T g_rs485Pool;
#endif

